import 'package:wch/generated/json/base/json_convert_content.dart';
import 'package:wch/model/acquisition_entity.dart';

AcquisitionEntity $AcquisitionEntityFromJson(Map<String, dynamic> json) {
  final AcquisitionEntity acquisitionEntity = AcquisitionEntity();
  final List<
      AcquisitionAcquisitionLabelList>? acquisitionLabelList = (json['acquisitionLabelList'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<AcquisitionAcquisitionLabelList>(
          e) as AcquisitionAcquisitionLabelList).toList();
  if (acquisitionLabelList != null) {
    acquisitionEntity.acquisitionLabelList = acquisitionLabelList;
  }
  return acquisitionEntity;
}

Map<String, dynamic> $AcquisitionEntityToJson(AcquisitionEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['acquisitionLabelList'] =
      entity.acquisitionLabelList?.map((v) => v.toJson()).toList();
  return data;
}

extension AcquisitionEntityExtension on AcquisitionEntity {
  AcquisitionEntity copyWith({
    List<AcquisitionAcquisitionLabelList>? acquisitionLabelList,
  }) {
    return AcquisitionEntity()
      ..acquisitionLabelList = acquisitionLabelList ??
          this.acquisitionLabelList;
  }
}

AcquisitionAcquisitionLabelList $AcquisitionAcquisitionLabelListFromJson(
    Map<String, dynamic> json) {
  final AcquisitionAcquisitionLabelList acquisitionAcquisitionLabelList = AcquisitionAcquisitionLabelList();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    acquisitionAcquisitionLabelList.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    acquisitionAcquisitionLabelList.name = name;
  }
  final String? colour = jsonConvert.convert<String>(json['colour']);
  if (colour != null) {
    acquisitionAcquisitionLabelList.colour = colour;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    acquisitionAcquisitionLabelList.type = type;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    acquisitionAcquisitionLabelList.status = status;
  }
  final String? text = jsonConvert.convert<String>(json['text']);
  if (text != null) {
    acquisitionAcquisitionLabelList.text = text;
  }
  final String? hospitalId = jsonConvert.convert<String>(json['hospitalId']);
  if (hospitalId != null) {
    acquisitionAcquisitionLabelList.hospitalId = hospitalId;
  }
  return acquisitionAcquisitionLabelList;
}

Map<String, dynamic> $AcquisitionAcquisitionLabelListToJson(
    AcquisitionAcquisitionLabelList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['colour'] = entity.colour;
  data['type'] = entity.type;
  data['status'] = entity.status;
  data['text'] = entity.text;
  data['hospitalId'] = entity.hospitalId;
  return data;
}

extension AcquisitionAcquisitionLabelListExtension on AcquisitionAcquisitionLabelList {
  AcquisitionAcquisitionLabelList copyWith({
    String? id,
    String? name,
    String? colour,
    int? type,
    String? status,
    String? text,
    String? hospitalId,
  }) {
    return AcquisitionAcquisitionLabelList()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..colour = colour ?? this.colour
      ..type = type ?? this.type
      ..status = status ?? this.status
      ..text = text ?? this.text
      ..hospitalId = hospitalId ?? this.hospitalId;
  }
}